package com.gsafety.wellsfort.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.gsafety.wellsfort.common.context.LoginContextUtil;
import com.gsafety.wellsfort.common.enums.CustomerTypeEnum;
import com.gsafety.wellsfort.domain.model.course.Course;
import com.gsafety.wellsfort.domain.model.course.LessonPeriod;
import com.gsafety.wellsfort.domain.model.knowledge.*;
import com.gsafety.wellsfort.domain.model.security.Admin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 描述:cls_lesson_period表的实体类
 *
 * @author: zhoutanxin
 * @创建时间: 2020-05-02
 */
@Data
@ApiModel(value = "课时详情")
public class LessonPeriodVO {
    private Integer id;

    @ApiModelProperty(value = "所属课程ID")
    private Integer courseId;

    @ApiModelProperty(value = "课时名称")
    private String name;

    @ApiModelProperty(value = "上课老师")
    private Admin teacher;
    @ApiModelProperty(value = "上课老师姓名")
    private String teacherName;

    @ApiModelProperty(value = "时长")
    private Integer duration;

    @ApiModelProperty(value = "上课状态:1是或0否")
    private Byte isAttendClass;

    @ApiModelProperty(value = "上课时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date attendClassTime;

    @ApiModelProperty(value = "授课状态:1是或0否")
    private Byte isTeaching;

    @ApiModelProperty(value = "授课时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date teachingTime;

    @ApiModelProperty(value = "课时简介")
    private String introduction;

    @ApiModelProperty(value = "课程教材")
    private TeachingMaterial teachingMaterial;

    @ApiModelProperty(value = "课件列表")
    private List<Courseware> coursewareList;

    @ApiModelProperty(value = "教具列表")
    private List<TeachingAid> teachingAidList;

    @ApiModelProperty(value = "作业")
    private Work work;

    @ApiModelProperty(value = "作业是否已发布")
    private Byte isWorkPublish;

    @ApiModelProperty(value = "试卷")
    private ExamPaper examPaper;

    @ApiModelProperty(value = "试卷是否已发布")
    private Byte isExamPublish;
    @ApiModelProperty(value = "课时学习进度")
    private String rate;
    @ApiModelProperty(value = "是否发布:1是或0否")
    private Integer publishState;
    /**
     * 试卷ID
     */
    @ApiModelProperty(value = "试卷ID")
    private Integer examId;

    @ApiModelProperty(value = "作业发布记录ID")
    private Integer workPublishId;
    @ApiModelProperty(value = "考试发布记录ID")
    private Integer examPublishId;
    @ApiModelProperty(value = "视频观看时间")
    private Integer videoWatchTime;
    public static class VOBuilder {
        LessonPeriod lessonPeriod;
        LessonPeriodVO lessonPeriodVO = new LessonPeriodVO();

        public VOBuilder(LessonPeriod q) {
            this.lessonPeriod = q;
        }

        public LessonPeriodVO build() {
            BeanUtils.copyProperties(lessonPeriod, lessonPeriodVO);
            lessonPeriodVO.setPublishState(lessonPeriod.getPublishState() == null ? 0 :
                    lessonPeriod.getPublishState());
            return lessonPeriodVO;
        }
    }
}